﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Publicuse.Entity.AttributeUtil.Validate
{
    /// <summary>
    /// 最大值验证
    /// </summary>
    public class MaxAttribute : BaseValidateAttribute
    {
        private double max = 0;
        private string remark = null;

        public double GetMax { get { return this.max; } }

        public string GetRemark { get { return this.remark; } }

        public MaxAttribute(double max, string remark)
        {
            this.max = max;
            this.remark = remark;
        }

        public override bool Validate(object oValue)
        {
            if (oValue != null && !string.IsNullOrEmpty(oValue.ToString()))
            {
                return Convert.ToDouble(oValue.ToString()) < this.max;
            }
            else
            {
                return true;
            }
        }
    }
}
